<%@ include file="/common/taglibs.jsp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Spring3-MiniWeb | User</title>

<link href="<c:url value="/resources/blueprint/screen.css" />"
	rel="stylesheet" type="text/css" />

<link href="<c:url value="/resources/style.css" />" rel="stylesheet"
	type="text/css" />

</head>
<body>

	<c:url var="addUrl" value="/account/user/save" />

	<div class="container">
		<%@ include file="/common/header.jsp"%>


		<div id="content">
			<div class="span-24 last">
				<div id="filter">
					你好,
					<security:authentication property="name" />
				</div>
				<table>
					<thead>
						<tr>
							<th>登录名</th>
							<th>姓名</th>
							<th>电子邮件</th>
							<th>角色</th>
							<th colspan="3">Operation</th>
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${userList}" var="user">
							<c:url var="editUrl" value="/account/user/edit/${user.id}" />
							<c:url var="deleteUrl" value="/account/user/delete/${user.id}" />
							<tr>
								<td><c:out value="${user.loginName}" /></td>
								<td><c:out value="${user.name}" /></td>
								<td><c:out value="${user.email}" /></td>
								<td><c:out value="${user.roleNames}" /></td>

								<security:authorize ifAnyGranted="ROLE_浏览用户">
									<security:authorize ifNotGranted="ROLE_修改用户">
										<td><a href="${editUrl}">View</a></td>
									</security:authorize>
								</security:authorize>

								<security:authorize ifAnyGranted="ROLE_修改用户">
									<td><a href="${editUrl}">Edit</a></td>
									<td><a href="${deleteUrl}">Delete</a></td>

								</security:authorize>
							</tr>
						</c:forEach>
					</tbody>
				</table>
				<security:authorize ifAnyGranted="ROLE_修改用户">
					<p>
						<a href="${addUrl}">Add New User</a>
					</p>
				</security:authorize>
			</div>
		</div>
		<%@ include file="/common/footer.jsp"%>
	</div>
</body>
</html>